<include file="public/header" />
<div class="layui-fluid" style="margin-top: 50px;">
  <form class="layui-form" action="">
    <div class="layui-row" style="margin: auto">
      <div class="layui-form-item">
        <label class="layui-form-label">单行选择框</label>
        <div class="layui-input-block" style="width: 300px;" >
          <select name="store_id" lay-verify="required"  lay-filter="branchid">
            <option value=""></option>
            <foreach name="stores" item="vo">
              <option value="{$vo.id}">{$vo.name}</option>
            </foreach>


          </select>
        </div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">微信appid</label>
      <div class="layui-input-block">
        <input type="text" name="appid" required style="width: 120px;"  placeholder="微信支付appid" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">微信商户号</label>
      <div class="layui-input-block">
        <input type="text" name="merchant_id" required style="width: 120px;" placeholder="微信商户号" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">微信key</label>
      <div class="layui-input-block">
        <input type="text" name="appkey" required style="width: 120px;"  placeholder="微信key" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">微信公钥文件内容</label>
      <div class="layui-input-block">
        <textarea type="text" name="sllcart_code"  style="width: 520px;"  placeholder="微信公钥文件内容" autocomplete="off" class="layui-textarea"></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">微信私钥文件内容</label>
      <div class="layui-input-block">
        <textarea type="text" name="sllkey_code"  style="width: 520px;"  placeholder="微信私钥文件内容" autocomplete="off" class="layui-textarea"></textarea>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">分账比例%</label>
      <div class="layui-input-block">
        <input type="text" name="rate" required style="width: 120px;"  placeholder="分账比例" autocomplete="off" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">开启分账</label>
      <div class="layui-input-block">
        <input type="radio" name="state" value="1"  checked title="是">
        <input type="radio" name="state" value="0" title="否" >
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label"></label>
      <div class="layui-input-block">
        <button lay-submit lay-filter="save" class="layui-btn">保存
        </button>
      </div>
    </div>

</div>
</form>

</div>
<script>

  layui.use(['form', 'layedit', 'laydate','jquery','upload'], function(){

    var form = layui.form
            ,layer = layui.layer
            , $ = layui.jquery
            , upload = layui.upload
            ,laydate = layui.laydate
            ,inputTags = layui.inputTags
    var layedit = layui.layedit;
    //拖拽上传

    //自定义验证规则
    form.verify({
      branchid: function (value) {
        if (value.length < 1) {
          return '请选择所属门店';
        }
      },
    });



    //监听提交
    form.on('submit(save)', function (data) {

      $.post($('form').attr('action'), data.field, function (data) {


        if (data.code === 200) {
          //   alert(data.status)
          setTimeout(function () {
            xadmin.close();
            xadmin.father_reload();
          }, 1000);
        } else {
          layer.msg(res.msg);
        }
        //  animated()
      });
      // $.ajax({
      //     type: "post",
      //     url: $('form').attr('action'),
      //     data:JSON.stringify(data.field),
      //     contentType: 'application/json',
      //     success: function (data) {
      //       if (data.code == 200) {
      //              alert(data.status)
      //           setTimeout(function () {
      //           xadmin.close();
      //                   xadmin.father_reload();
      //                }, 1000);
      //             } else {
      //               layer.msg(data.msg);
      //         }
      //
      //     }
      // });


      // layer.alert(JSON.stringify(data.field), {
      //     title: '最终的提交信息'
      // })
      return false;
    });

  });

</script>
</body>

</html>
